package com.lm.akka.actor;

import akka.actor.AbstractActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;

public class PrintActor extends AbstractActor {
    private final LoggingAdapter log = Logging.getLogger(getContext().getSystem(), this);

    @Override
    public Receive createReceive() {
        return receiveBuilder()
                .match(String.class, msg -> {
                    log.info("接收到消息: {}", msg);
                    Thread.sleep(500); // 模拟业务处理
                    getSender().tell("处理完成: " + msg, getSelf());
                })
                .build();
    }
}